package com.jymj.controller;

import com.jymj.entity.data.PatrolEntity;
import com.jymj.entity.landmanage.PjEnviorSupvsEntity;
import com.jymj.entity.landmanage.ScoreEntity;
import com.jymj.service.EnviorPatrolSerice;
import com.jymj.utils.PageUtils;
import com.jymj.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * Created by ${lc} on 2020/11/26. 报表 查询 统计
 */
@RequestMapping("/patrol")
@RestController
public class EnviorPatrolController {

    @Autowired
    private EnviorPatrolSerice enviorPatrolSerice;

    //报表按村统计
    @RequestMapping("/queryByCun")
    public R queryByCun(@RequestBody PatrolEntity patrolEntity){
        List<ScoreEntity> scoreEntities = enviorPatrolSerice.queryScore(patrolEntity);
        int total = enviorPatrolSerice.queryScoreTotal(patrolEntity);
        PageUtils pageUtil = new PageUtils(scoreEntities, total, patrolEntity.getLimit(), patrolEntity.getPage());
        return R.ok().put("data",pageUtil);
    }

    //报表 列表查询
    @RequestMapping("/queryList")
    public R queryList(@RequestBody PatrolEntity patrolEntity){
        List<PjEnviorSupvsEntity> pjEnviorSupvsEntities = enviorPatrolSerice.queryList(patrolEntity);
        int total = enviorPatrolSerice.queryTotal(patrolEntity);
        PageUtils pageUtil = new PageUtils(pjEnviorSupvsEntities, total, patrolEntity.getLimit(), patrolEntity.getPage());
        return R.ok().put("data",pageUtil);
    }

}
